package sdk.pay.model;

import android.text.TextUtils;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

import static sdk.pay.constant.PayConstant.VERSION_CODE;

/**
 * Created by Steven on 2016/8/30 0030.
 */
public final class TokenParam implements Serializable {
    private String systemName = "";         // 平台标识 必填
    private String key = "";                // AES密钥 必填
    private String vector = "";             // AES向量 必填

    private String p1_appid;           //商户应用编号
    private String p2_orderNumber;     //商户订单号
    private String p3_money;           //商户订单金额(元精确到分如：99.99)
    private String p6_orderTime;       //商户订单时间(格式为yyyyMMddHHmmss)
    private String p7_productCode;     //商户支付产品code
    private String p8_sign;            //商户订单签名
    private final String p9_signType = "1";  //默认为1
    private String p10_bankCardCode; //商户-银行卡或卡类编码
    private String p11_cardType;       //商户-客户支付银行卡类型id
    private String p12_channel;        //商户-客户支付银行卡支付类型
    private String p13_orderFailerTime;//商户-订单失效时间
    private String p14_customName = "";  //商户-客户游戏账号(终端账号)
    private String p15_customcontact;             //商户-客户联系内容
    private String p16_customip;       //商户-客户ip地址
    private String p17_product;        //商户-商品名称
    private String p18_productCat;     //商户-商品种类
    private String p19_productNum;     //商户-商品数量
    private String p20_pdesc;          //商户-商品描述
    private String p21_version;        //商户-对接版本
    private final String p22_sdkVersion = VERSION_CODE; //商户-sdk版本
    private String p23_charset;        //商户-提交编码格式
    private String p24_remark;         //商户-订单自己备注
    private final String p25_terminal = "3"; //商户-客户终端设备值 1pc  2ios  3 安卓

    public String getSystemName() {
        return systemName;
    }

    public void setSystemName(String systemName) {
        this.systemName = systemName;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getVector() {
        return vector;
    }

    public void setVector(String vector) {
        this.vector = vector;
    }

    public String getP1_appid() {
        return p1_appid;
    }

    public void setP1_appid(String p1_appid) {
        this.p1_appid = p1_appid;
    }

    public String getP2_orderNumber() {
        return p2_orderNumber;
    }

    public void setP2_orderNumber(String p2_orderNumber) {
        this.p2_orderNumber = p2_orderNumber;
    }

    public String getP3_money() {
        return p3_money;
    }

    public void setP3_money(String p3_money) {
        this.p3_money = p3_money;
    }

    public String getP6_orderTime() {
        return p6_orderTime;
    }

    public void setP6_orderTime(String p6_orderTime) {
        this.p6_orderTime = p6_orderTime;
    }

    public String getP7_productCode() {
        return p7_productCode;
    }

    public void setP7_productCode(String p7_productCode) {
        this.p7_productCode = p7_productCode;
    }

    public String getP8_sign() {
        return p8_sign;
    }

    public void setP8_sign(String p8_sign) {
        this.p8_sign = p8_sign;
    }

    public String getP9_signType() {
        return p9_signType;
    }

    public String getP10_bankCardCode() {
        return p10_bankCardCode;
    }

    public void setP10_bankCardCode(String p10_bankCardCode) {
        this.p10_bankCardCode = p10_bankCardCode;
    }

    public String getP11_cardType() {
        return p11_cardType;
    }

    public void setP11_cardType(String p11_cardType) {
        this.p11_cardType = p11_cardType;
    }

    public String getP12_channel() {
        return p12_channel;
    }

    public void setP12_channel(String p12_channel) {
        this.p12_channel = p12_channel;
    }

    public String getP13_orderFailerTime() {
        return p13_orderFailerTime;
    }

    public void setP13_orderFailerTime(String p13_orderFailerTime) {
        this.p13_orderFailerTime = p13_orderFailerTime;
    }

    public String getP14_customName() {
        return p14_customName;
    }

    public void setP14_customName(String p14_customName) {
        this.p14_customName = p14_customName;
    }

    public String getP15_customcontact() {
        return p15_customcontact;
    }

    public void setP15_customcontact(String p15_customcontact) {
        this.p15_customcontact = p15_customcontact;
    }

    public String getP16_customip() {
        return p16_customip;
    }

    public void setP16_customip(String p16_customip) {
        this.p16_customip = p16_customip;
    }

    public String getP17_product() {
        return p17_product;
    }

    public void setP17_product(String p17_product) {
        this.p17_product = p17_product;
    }

    public String getP18_productCat() {
        return p18_productCat;
    }

    public void setP18_productCat(String p18_productCat) {
        this.p18_productCat = p18_productCat;
    }

    public String getP19_productNum() {
        return p19_productNum;
    }

    public void setP19_productNum(String p19_productNum) {
        this.p19_productNum = p19_productNum;
    }

    public String getP20_pdesc() {
        return p20_pdesc;
    }

    public void setP20_pdesc(String p20_pdesc) {
        this.p20_pdesc = p20_pdesc;
    }

    public String getP21_version() {
        return p21_version;
    }

    public void setP21_version(String p21_version) {
        this.p21_version = p21_version;
    }

    public String getP22_sdkVersion() {
        return p22_sdkVersion;
    }

    public String getP23_charset() {
        return p23_charset;
    }

    public void setP23_charset(String p23_charset) {
        this.p23_charset = p23_charset;
    }

    public String getP24_remark() {
        return p24_remark;
    }

    public void setP24_remark(String p24_remark) {
        this.p24_remark = p24_remark;
    }

    public String getP25_terminal() {
        return p25_terminal;
    }

    @Override
    public String toString() {
        return "TokenParam{" +
                "p1_appid='" + p1_appid + '\'' +
                ", p2_ordernumber='" + p2_orderNumber + '\'' +
                ", p3_money='" + p3_money + '\'' +
                ", p6_ordertime='" + p6_orderTime + '\'' +
                ", p7_productcode='" + p7_productCode + '\'' +
                ", p8_sign='" + p8_sign + '\'' +
                ", p9_signtype='" + p9_signType + '\'' +
                ", p10_bank_card_code='" + p10_bankCardCode + '\'' +
                ", p11_cardtype='" + p11_cardType + '\'' +
                ", p12_channel='" + p12_channel + '\'' +
                ", p13_orderfailertime='" + p13_orderFailerTime + '\'' +
                ", p14_customname='" + p14_customName + '\'' +
                ", p15_customcontact='" + p15_customcontact + '\'' +
                ", p16_customip='" + p16_customip + '\'' +
                ", p17_product='" + p17_product + '\'' +
                ", p18_productcat='" + p18_productCat + '\'' +
                ", p19_productnum='" + p19_productNum + '\'' +
                ", p20_pdesc='" + p20_pdesc + '\'' +
                ", p21_version='" + p21_version + '\'' +
                ", p22_version='" + p22_sdkVersion + '\'' +
                ", p23_charset='" + p23_charset + '\'' +
                ", p24_remark='" + p24_remark + '\'' +
                ", p25_terminal='" + p25_terminal + '\'' +
                '}';
    }

    public JSONObject getTokenParams() throws JSONException {
        JSONObject object = new JSONObject();
        if (!TextUtils.isEmpty(p1_appid))
            object.put("p1_yingyongnum", p1_appid);
        if (!TextUtils.isEmpty(p2_orderNumber))
            object.put("p2_ordernumber", p2_orderNumber);
        if (!TextUtils.isEmpty(p3_money))
            object.put("p3_money", p3_money);
        if (!TextUtils.isEmpty(p6_orderTime))
            object.put("p6_ordertime", p6_orderTime);
        if (!TextUtils.isEmpty(p7_productCode))
            object.put("p7_productcode", p7_productCode);
        if (!TextUtils.isEmpty(p8_sign))
            object.put("p8_sign", p8_sign);
        if (!TextUtils.isEmpty(p9_signType))
            object.put("p9_signtype", p9_signType);
        if (!TextUtils.isEmpty(p10_bankCardCode))
            object.put("p10_bank_card_code", p10_bankCardCode);
        if (!TextUtils.isEmpty(p11_cardType))
            object.put("p11_cardtype", p11_cardType);
        if (!TextUtils.isEmpty(p12_channel))
            object.put("p12_channel", p12_channel);
        if (!TextUtils.isEmpty(p13_orderFailerTime))
            object.put("p13_orderfailertime", p13_orderFailerTime);
        if (!TextUtils.isEmpty(p14_customName))
            object.put("p14_customname", p14_customName);
        if (!TextUtils.isEmpty(p15_customcontact))
            object.put("p15_customcontact", p15_customcontact);
        if (!TextUtils.isEmpty(p16_customip))
            object.put("p16_customip", p16_customip);
        if (!TextUtils.isEmpty(p17_product))
            object.put("p17_product", p17_product);
        if (!TextUtils.isEmpty(p18_productCat))
            object.put("p18_productcat", p18_productCat);
        if (!TextUtils.isEmpty(p19_productNum))
            object.put("p19_productnum", p19_productNum);
        if (!TextUtils.isEmpty(p20_pdesc))
            object.put("p20_pdesc", p20_pdesc);
        if (!TextUtils.isEmpty(p21_version))
            object.put("p21_version", p21_version);
        if (!TextUtils.isEmpty(p22_sdkVersion))
            object.put("p22_sdkversion", p22_sdkVersion);
        if (!TextUtils.isEmpty(p23_charset))
            object.put("p23_charset", p23_charset);
        if (!TextUtils.isEmpty(p24_remark))
            object.put("p24_remark", p24_remark);
        if (!TextUtils.isEmpty(p25_terminal))
            object.put("p25_terminal", p25_terminal);
        return object;

    }
}
